import requests

# params = {'firstname': 'Ryan', 'name': 'Mitchell'}
# r = requests.post("http://pythonscraping.com/files/processing.php", data=params)
# print(r.text)

# files = {'uploadFile': open('logo.jpg', 'rb')}
# r = requests.post("http://pythonscraping.com/pages/files/processing2.php", files=files)

# session = requests.Session()
# params = {'username': 'password', 'password': 'password'}
# r = session.post('http://pythonscraping.com/pages/cookies/welcome.php', params)
# print('return cookie is:')
# print(r.cookies.get_dict())

from selenium import webdriver
import time

# from selenium.webdriver.chrome.options import Options
# chrome_options = Options()
# chrome_options.add_argument('--headless')
# chrome_options.add_argument('--disable-gpu')
# driver = webdriver.Chrome(executable_path=r'C:\Users\Administrator\AppData\Local\Google\Chrome\Application\chromedriver.exe',options=chrome_options)

from selenium.webdriver.firefox.options import Options
firefox_options = Options()
firefox_options.add_argument('--headless')
firefox_options.add_argument('--disable-gpu')
driver = webdriver.Firefox(executable_path=r'C:\Program Files\Mozilla Firefox\geckodriver.exe', options=firefox_options)
# driver.get('https://m.weibo.cn/u/3669102477')
driver.get("http://pythonscraping.com/pages/javascript/ajaxDemo.html")
# print(driver.find_element_by_id('content').text)
time.sleep(5)
print(driver.page_source)
# print(driver.find_element_by_id('content').text)
driver.close()